﻿/****************
 * Copyright 2016 Brian Tabone
 * Licensed under the Apache 2.0 License
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * IConversation.cs
 * Defines the interface for sending and receiving conversation messages
 * 8/11/2016
 */

using System;
using System.ServiceModel;

namespace IAO.Common.Interfaces.MessageInterfaces
{
    [ServiceContract]
    public interface IConversation
    {
        /// <summary>
        ///     THe unique id for the conversation, gets created when a new conversation GUID comes in
        /// </summary>
        Guid ConversationID { get; }

        /// <summary>
        ///     Callers use this to package a message to be sent to the receivers "ReceiveMessage"
        /// </summary>
        /// <param name="converstionId">GUID for conversation</param>
        /// <param name="messageId">GUID for message</param>
        /// <param name="messageContent">content of message</param>
        /// <param name="messageLifetimeMS">
        ///     Time before message expires (Expired messages should be discarded if not read by the
        ///     expiration time
        /// </param>
        void SendMessage(string receiverURI, string converstionId, string messageId, string messageContent,
            long messageLifetimeMS);

        /// <summary>
        ///     Public interface that receives messages. This function is a producer which puts the messages (in the order
        ///     recieved) into a consumer queue to be handled.
        /// </summary>
        /// <param name="converstionId"></param>
        /// <param name="messageId"></param>
        /// <param name="messageContent"></param>
        /// <param name="messageLifetimeMS"></param>
        [OperationContract]
        void RecieveMessage(Guid messageId, string messageContent, long messageLifetimeMS);
    }
}